package exception;

import java.util.Arrays;
import java.util.function.Supplier;

/**
 * Description: 测试类
 *
 * @author code-worker
 * @date 2021/10/09 19:04
 */
public class Test {

    private static void throwException(Supplier<CustomException> supplier){
        long startTime = System.currentTimeMillis();
        try{
            throw supplier.get();
        }catch (CustomException e){
            System.out.println(Arrays.toString(e.getStackTrace()));
        }
        long endTime = System.currentTimeMillis();
        System.out.println(endTime-startTime);
    }

    public static void main(String[] args) {
        throwException(()-> new CustomException("message"));
        throwException(()-> new CustomException("message", true));
    }
}
